    <div class="message">
      {if $message} {$message} {/if}    
    </div>
    
    
    
    
    
   
    {if $galleries} 
     
      
      {foreach from=$galleries item=gallery}
      <form name="new_photo_form" method="post" enctype="multipart/form-data" action="{$new_photo_form_action}">
        <input type="file" name="photo[link]" />
        <input type="text" name="photo[title]" />
        <textarea name="photo[text]"></textarea>
        <input type="hidden" name="section_id" value="{$gallery.sections_id}" />
        <input type="hidden" name="gallery_id" value="{$gallery.galleries_id}" />
        <button>Загрузить</button>
      </form>
      
      <br/>
      {if $gallery.photos != -1}
      <form name="update_photo_form" method="post" action="{$update_photo_form_action}">
      <input type="hidden" name="section_id" value="{$gallery.sections_id}" />
      <button>Сохранить</button>
        <table class="edit tour-photo ">
        <tbody>
        <tr>
          <th>Удалить
          </th>
          <th>Миниатюра
          </th>
          <th>Название
          </th>
          <th>Описание
          </th>
          <th>Порядок вывода
          </th>
        </tr>
        
          {foreach from=$gallery.photos item=photo}
          <tr class="">
            <td><input type="checkbox" name="image[{$photo.photo_id}][delete]" value="" />  </td>
            
            <td><img src="{$photo.link_sm}" style="max-width:100px;" />  </td>
            
            <td><input type="text" name="image[{$photo.photo_id}][title]" value="{$photo.title}" /></input></td>
            <td><textarea name="image[{$photo.photo_id}][text]">{$photo.text}</textarea></td>
            <td><input type="text" name="image[{$photo.photo_id}][sort]" value="{$photo.sort}" /></input></td>
          </tr> 
          {/foreach}
        </tbody>
        </table>  
      <button>Сохранить</button> 
      </form>
      {/if}
      {/foreach} 
     
    {/if} 
  
    
    
    
    {*if $photos}
      <form name="update_photo_form" method="post" action="{$update_photo_form_action}">
      
      <button>Сохранить</button>
      
      <table class="edit tour-photo ">
      <tbody>
      <tr>
        <th>Удалить
        </th>
        <th>Миниатюра
        </th>
        <th>Название
        </th>
        <th>Описание
        </th>
        <th>Порядок вывода
        </th>
      </tr>
      {foreach from=$photos item=photo}
      <tr class="">
        <td><input type="checkbox" name="image[{$photo.photo_id}][delete]" value="" />  </td>
        
        <td><img src="{$photo.link}" style="max-width:100px;" />  </td>
        
        <td><input type="text" name="image[{$photo.photo_id}][title]" value="{$photo.title}" /></input></td>
        <td><textarea name="image[{$photo.photo_id}][text]">{$photo.text}</textarea></td>
        <td><input type="text" name="image[{$photo.photo_id}][sort]" value="{$photo.sort}" /></input></td>
      </tr>
      {/foreach}
      </tbody>
      </table>
      
       <button>Сохранить</button>
      
      </form>
    {/if*}